package com.xzwk.yn.serveradmin.controller;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;

/**
 *@Author: YN
 *@CreateTime: 2025-08-06
 *@Description:
 *@Version: 1.0
 */

public class LeftController implements Initializable {



  @FXML
  private VBox centerLeft;

  @FXML
  private Button dashboardBtn;

  @FXML
  private VBox menuContainer;

  @FXML
  private Button settingsBtn;

  @FXML
  private Button userManagementBtn;

  @FXML
  private void handleMenuClick(javafx.event.ActionEvent event) {
    Button clickedButton = (Button) event.getSource();

    // 清除所有按钮的选中状态
    clearButtonSelection();

    // 设置当前按钮为选中状态
    clickedButton.setStyle("-fx-background-color: rgba(0, 144, 153, 0.5); -fx-text-fill: white; -fx-font-size: 14px; -fx-alignment: center-left; -fx-padding: 0 0 0 20;");

    // 根据点击的按钮加载不同的内容
    if (clickedButton == dashboardBtn) {
//      contentTitle.setText("控制面板");
      // 加载控制面板内容
    } else if (clickedButton == userManagementBtn) {
//      contentTitle.setText("用户管理");
      // 加载用户管理内容
    } else if (clickedButton == settingsBtn) {
//      contentTitle.setText("系统设置");
      // 加载系统设置内容
    }
  }

  private void clearButtonSelection() {
    String defaultStyle = "-fx-background-color: transparent; -fx-text-fill: white; -fx-font-size: 14px; -fx-alignment: center-left; -fx-padding: 0 0 0 20;";
    dashboardBtn.setStyle(defaultStyle);
    userManagementBtn.setStyle(defaultStyle);
    settingsBtn.setStyle(defaultStyle);
  }
  @Override
  public void initialize(URL url, ResourceBundle resourceBundle) {
    System.out.println("左侧菜单加载成功！");
  }
}
